<template>
  <!-- 头部部分 -->
  <header class="header">
    <h1>todos</h1>
    <input class="new-todo" placeholder="请输入任务名称" autofocus @keyup.enter="addlist" v-model.trim="todolist" />
  </header>
</template>

<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      todolist: ''
    }
  },

  methods: {
    addlist() {
      if (!this.todolist) return
      this.$emit('addlist', this.todolist)
      this.todolist = ''
    }
  }
}
</script>

<style scoped></style>
